package com.webber.demo.common.utils;

import java.util.StringTokenizer;

/**
 * JDK版本检查类VSB移植过来的
 * @author lmz
 *
 */
public class JDKVersionChecker {
	public static boolean check(String myVersion)
	  {
	    String str = System.getProperty("java.version");
	    boolean bool;
	    try
	    {
	      bool = checkVersion(str, myVersion) >= 0;
	    }
	    catch (NumberFormatException localNumberFormatException)
	    {
	      bool = false;
	    }
	    return bool;
	  }
	  
	  private static int checkVersion(String sysVersion, String myVersion)
	  {
	    StringTokenizer localStringTokenizer1 = new StringTokenizer(myVersion, "._");
	    StringTokenizer localStringTokenizer2 = new StringTokenizer(myVersion, "._");
	    while (localStringTokenizer1.hasMoreTokens())
	    {
	      if (!localStringTokenizer2.hasMoreTokens()) {
	        return 1;
	      }
	      int i = Integer.parseInt(localStringTokenizer1.nextToken());
	      int j = Integer.parseInt(localStringTokenizer2.nextToken());
	      int k = i - j;
	      if (k != 0) {
	        return k;
	      }
	    }
	    return localStringTokenizer2.hasMoreTokens() ? -1 : 0;
	  }
}
